beginobjectscript; // basic box

// Cell 0,1 - A stuff done flag. If this flag is 0 and the zone
//   is clear, we erase this box. It's set to 1 if a player opens it.

variables;
	short i_am_open = 0;
body;

beginstate INIT_STATE;
	if (get_memory_cell(0) > 0) {
		if ((gf(get_memory_cell(0),get_memory_cell(1)) == 0) && (is_town_clear(ME)))
			kill_object(ME,1);
		}
	break;

beginstate DEAD_STATE;

break;

beginstate START_STATE;

break;

beginstate USE_STATE;
	if (get_memory_cell(0) > 0) {
		sf(get_memory_cell(0),get_memory_cell(1),1);
		}


	open_container();
	end();
	
	if (i_am_open == 0) {
		i_am_open = 1;
		open_container();
		}
		else {
			close_container();
			i_am_open = 0;
			}
break;
